package com.bangdream.michelia.entity;

import com.google.gson.Gson;

import java.io.Serializable;

/**
 * Created by Mr.Wang on 2017/8/29.
 * 909732184@qq.com
 */

public class BaseEntity<T> implements Serializable {


    private String result;
    private String message;
    private int cntPage;
    private int cntData;
    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    //该方法假设服务器返回200表示成功返回结果，其他数字表示异常
    public boolean isOk() {
        return result!=null&&result.equals("Success");
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public BaseEntity() {

    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public int getCntPage() {
        return cntPage;
    }

    public void setCntPage(int cntPage) {
        this.cntPage = cntPage;
    }

    public int getCntData() {
        return cntData;
    }

    public void setCntData(int cntData) {
        this.cntData = cntData;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
